package com.cetccloud.ap.proxy.channel.cossDomain.s30.channel.send;

import com.cetccloud.ap.proxy.channel.cossDomain.s30.S30Adapter;
import com.wish.xsagent.JXSAgent;
import io.vertx.core.Vertx;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName Conn4SendHandle
 * @Description
 * @Author superz
 * @Date 2021/4/23 10:11
 * @Version 1.0
 **/
@Slf4j
@Data
@Component
public class Conn4SendHandle implements JXSAgent.conn_func_ptr {

    @Autowired
    private Vertx vertx;

    private boolean connected = false;

    @Override
    public void invoke(boolean result) {
        connected = result;
        log.info("### Conn4SendHandle ### {}", connected);

        vertx.eventBus().publish(S30Adapter.SEND_CONNECTED_EVENT, String.valueOf(connected));
    }
}
